UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hv2vz98XP+Fb/iwrorLY1+HnD3Zv7smz8fAcfgxyoG0=' 
WHERE 
  key_id = 'b999779f485feb7748645396e661f0cdfd1e4db27539cedb7e060fdc9abe62fc' 
  AND (
    token = 'hv2vz98XP+Fb/iwrorLY1+HnD3Zv7smz8fAcfgxyoG0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046