UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7G6oebQIOCPUzzveadDRag3YFDPP8ecabmhoxFWk7+s=' 
WHERE 
  key_id = '543b21a603f8e424e5e10c9f8325fb6b79d56bba03c2c2516448a170d060bfd8' 
  AND (
    token = '7G6oebQIOCPUzzveadDRag3YFDPP8ecabmhoxFWk7+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033