UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yNBuAYEpyJrCNvSYBEosOLQLTFT2Iw7g5Sjmnlu2gOk=' 
WHERE 
  key_id = '0e8534081c3dbb2a77bf846e0fed47db59b952ab8decdd67f2f4a73905ad428b' 
  AND (
    token = 'yNBuAYEpyJrCNvSYBEosOLQLTFT2Iw7g5Sjmnlu2gOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032