UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e80uAhVFMj+99DojS5ZqiJ1vym0rRa9ojfhtbefdU+8=' 
WHERE 
  key_id = '8ed7c68556ad5050bfe1fc713b90bde7dd5845adf3ce943d6d0091bcf4f2ddc4' 
  AND (
    token = 'e80uAhVFMj+99DojS5ZqiJ1vym0rRa9ojfhtbefdU+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046