UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bUkSZlBl/WzzJUdjiKcSNHpisJzGURANGyegposZfak=' 
WHERE 
  key_id = 'ff97c48988b1f1af2374f70e20ebf7a4d3f7b916fb17c6baeac6f10fc214a85d' 
  AND (
    token = 'bUkSZlBl/WzzJUdjiKcSNHpisJzGURANGyegposZfak=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026