UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rgVqCvXKcyinmyNuMlrBkT+qz9bGV2mqRs3ceTQC4oQ=' 
WHERE 
  key_id = '8b82278266dec4396fe7e479d2715e5681d5f660bfbac64117d9b75ad6374d25' 
  AND (
    token = 'rgVqCvXKcyinmyNuMlrBkT+qz9bGV2mqRs3ceTQC4oQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030