UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lV+dj6JRbgxbogX2VEB+hN/2mCWvFgDniQDwxMba70I=' 
WHERE 
  key_id = '4b5a5e8d545d3204092eeabcbb007e44ee3f4ade101aaf5e706f6bf3e573e40a' 
  AND (
    token = 'lV+dj6JRbgxbogX2VEB+hN/2mCWvFgDniQDwxMba70I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045