UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P8/6MPV/q9PPgLzIr53J7sqxen07o4ezFXi69U4htUc=' 
WHERE 
  key_id = 'bdc3f85f693e022defdee3f864571c58b4980b495c5d8772e427ebcfd21d6554' 
  AND (
    token = 'P8/6MPV/q9PPgLzIr53J7sqxen07o4ezFXi69U4htUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060