UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gq6Pg3DlkVir+UGYXOu7bGboLUO0QsXQLUKteefif+M=' 
WHERE 
  key_id = '3a9cd7767c56dc58b86c63038f7d2ed16cfb47e51ff2dfd11cc81ad2d84c5010' 
  AND (
    token = 'Gq6Pg3DlkVir+UGYXOu7bGboLUO0QsXQLUKteefif+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024