UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ag4yFm2xuWWSFXdxGhUW+6ouP68XhVcfvyy9Noe9ypA=' 
WHERE 
  key_id = 'fc578e9d1b0b0043c9110329dfd25a7526db9ea2bb828294c22ebf180abc71a1' 
  AND (
    token = 'ag4yFm2xuWWSFXdxGhUW+6ouP68XhVcfvyy9Noe9ypA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027