UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yycQO2VtBDz1e4HN0BBkvg6DXf0qq9YpwOIvbN9i+lk=' 
WHERE 
  key_id = '71877404f7477cd89b43f1e7aa65e1a7175f7ec1ee091d02d4777dfc44e883a9' 
  AND (
    token = 'yycQO2VtBDz1e4HN0BBkvg6DXf0qq9YpwOIvbN9i+lk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021