UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1lyBA0TUfvg1MUWXSgfFnC9UbChxsCkcOLR+7Hq4nqI=' 
WHERE 
  key_id = '8bb04258421d938e4741db9349667e3d868c7ecb13a09ffe40080619afe43a5f' 
  AND (
    token = '1lyBA0TUfvg1MUWXSgfFnC9UbChxsCkcOLR+7Hq4nqI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034