UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r7U3LlHAwT4BnlLkjD0tzcRLtyuxlq+66vSMMenK9XU=' 
WHERE 
  key_id = '69e1ae67a8555879fdeb27f8ad7032c1ed12d52509aa3f36e27de17ae3e33543' 
  AND (
    token = 'r7U3LlHAwT4BnlLkjD0tzcRLtyuxlq+66vSMMenK9XU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032