UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QSXcZ2LwQm9IbWkUnnDVrTD4EaYXE1h1UIOgv/rrngY=' 
WHERE 
  key_id = 'e4d690f7050178571e40f4faad15e98399a99b8bae66e022f909ac673f486549' 
  AND (
    token = 'QSXcZ2LwQm9IbWkUnnDVrTD4EaYXE1h1UIOgv/rrngY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00013