UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DNphYkl954cFInpWVUNi41QgwyF+zKnrivbS3QCxr2c=' 
WHERE 
  key_id = '8e6c143b4b8f008e369ed1ec95b8f5f3fd42f52640b2e9b7f469b8e6ffe23cc2' 
  AND (
    token = 'DNphYkl954cFInpWVUNi41QgwyF+zKnrivbS3QCxr2c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020