UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PNcGgdpv7qtYCDv3F9ehfOLt7nbpMd87S8SDAqlO4Bw=' 
WHERE 
  key_id = '97a960ea440d5b8c77043aaa9eb172f6750193f1ceef5df6200d99f4c52f5167' 
  AND (
    token = 'PNcGgdpv7qtYCDv3F9ehfOLt7nbpMd87S8SDAqlO4Bw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045