UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RUVESsfVxgUudUlSdq1T+jdO/n12HpPR6KhtYjsgLxk=' 
WHERE 
  key_id = '36076e40736f1579bf8588dacf274f48808941c27e2f1c5692f72f35f11cab05' 
  AND (
    token = 'RUVESsfVxgUudUlSdq1T+jdO/n12HpPR6KhtYjsgLxk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029