UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FiDzds5zmcXlrQVcFXcerk75CVZD+gvl1v5tsgG+DuA=' 
WHERE 
  key_id = '235345e2e5194b8c73cffa077ae6ed1b9f8c497615be0a2d1d08cd12d870f8c6' 
  AND (
    token = 'FiDzds5zmcXlrQVcFXcerk75CVZD+gvl1v5tsgG+DuA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027