UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IZ1twK+/rOooECTgGguxmlKl01+BOGq7aRRdtX47haU=' 
WHERE 
  key_id = '3da79b616711d394c1981d8f5659b852080f29deb78ecf4290e179233fbcb190' 
  AND (
    token = 'IZ1twK+/rOooECTgGguxmlKl01+BOGq7aRRdtX47haU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023