UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fm1iJKImtk4nyGFkRY/JOdO79edW/qBe+RES7pBLRck=' 
WHERE 
  key_id = '40b55ff1237555b195d35d318893afc0d17a57ce6e525e380febf1519fd3ab7e' 
  AND (
    token = 'fm1iJKImtk4nyGFkRY/JOdO79edW/qBe+RES7pBLRck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034