UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oPMCrsA5msYATiq68R9jLOOFhpcfaURESrtFYWGWmi4=' 
WHERE 
  key_id = '7e134de3d9e1676a1eefec30677660017865a1567789b4db6a34a973df893490' 
  AND (
    token = 'oPMCrsA5msYATiq68R9jLOOFhpcfaURESrtFYWGWmi4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036