UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eODZefYe4fV2I3hrQZrXqD1L9wBE5bHG6d3chL6H+DM=' 
WHERE 
  key_id = 'a1d717a45078cb1dfd6c04295ac666bf446233fde398989beeca1c603592f28c' 
  AND (
    token = 'eODZefYe4fV2I3hrQZrXqD1L9wBE5bHG6d3chL6H+DM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037