UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sApV+o2cRzm3yvQKS1usKsWdHlujYX9H2OYqMXY+qd8=' 
WHERE 
  key_id = '21c17b35db290cc718b1982b1039a76127f5dbf36332237e45fc990abb371eaf' 
  AND (
    token = 'sApV+o2cRzm3yvQKS1usKsWdHlujYX9H2OYqMXY+qd8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035