UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vViA/pLLuGmKDKHps7wOztXGLYA2nTUD6mv0p6gmD8I=' 
WHERE 
  key_id = '3cd4b41021a1442624979365df7f847fb319227c13498c7f8f90729a08775033' 
  AND (
    token = 'vViA/pLLuGmKDKHps7wOztXGLYA2nTUD6mv0p6gmD8I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032