UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ip9DzNkfRVgwDvR1RWbylhzK1d6PhKD1kmOyoBsibBM=' 
WHERE 
  key_id = 'd61778ebf932eff47d3772350e3f7ace7454bf0ffcd5731fc063c643e70da64c' 
  AND (
    token = 'ip9DzNkfRVgwDvR1RWbylhzK1d6PhKD1kmOyoBsibBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027