UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mORkbZBHFUtUJfW+9ioYrCc7WwkltGbgm6v454dXCcU=' 
WHERE 
  key_id = '49b9cdf25eca8b33baea06616048ee417193af5fdc7751fe73c770615f64edc0' 
  AND (
    token = 'mORkbZBHFUtUJfW+9ioYrCc7WwkltGbgm6v454dXCcU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031