UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oHkFvSUNDadaS+G4hQLTQ4oPU+ncqo+CoXzT6dbRiAM=' 
WHERE 
  key_id = '6919bdf23e5c77521b079736d669c06eeacc8042e2e8926701d4672901fe45d0' 
  AND (
    token = 'oHkFvSUNDadaS+G4hQLTQ4oPU+ncqo+CoXzT6dbRiAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047