UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OV6+SZyrkjfGVMMuxrlobfI986E+iV6a8qSHMKODTyk=' 
WHERE 
  key_id = '5de63cdb1c408ee4ba17641b6a1e23caa701bc58fdc43df46f90e5ed2e16a47f' 
  AND (
    token = 'OV6+SZyrkjfGVMMuxrlobfI986E+iV6a8qSHMKODTyk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027