UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FqVyBnzKLHafqMDTEHgWEwKHqvN7C93PtX1E7l0m3YQ=' 
WHERE 
  key_id = 'edce89756ff96000226d2be31294ffe194dc39804848d2dc00c6376f33493b2e' 
  AND (
    token = 'FqVyBnzKLHafqMDTEHgWEwKHqvN7C93PtX1E7l0m3YQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048