UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6geGxBClINS/Nd3lobSZOENyfRrORXZsoD6jEJE1FN0=' 
WHERE 
  key_id = 'dd3ce0e8b2817afba2768a7c20125b54a4398567abff1fb6c3602f9ee841675f' 
  AND (
    token = '6geGxBClINS/Nd3lobSZOENyfRrORXZsoD6jEJE1FN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046