UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e+gjZYN6ZwA7PJ5dkath/mpHE4H+STDv4brmEp7Ygzs=' 
WHERE 
  key_id = 'e425a804cdc56eacd02cfda16bc5c7b87402676348eb3282d7740392e23b9c84' 
  AND (
    token = 'e+gjZYN6ZwA7PJ5dkath/mpHE4H+STDv4brmEp7Ygzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046