UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6mUAs2/OhG613AGhLestFoBfMTqBbD4Tx0mQhK+J/80=' 
WHERE 
  key_id = '699ed81751edc0c3538b2e8156e2a255e9164d349fb9a576ee7f7dd095b6e072' 
  AND (
    token = '6mUAs2/OhG613AGhLestFoBfMTqBbD4Tx0mQhK+J/80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043